/**
 *博尔信基础开发平台
 *<br> 版权声明：厦门博尔信软件有限公司版权所有,违者必究
 *<br> Copyright:  Copyright (c) 2012
 *<br> Company:pearlsoft
 *<br> @author 蒋勇华
 *<br> 2012-5-16
 *<br> @version 1.0
 *————————————————————————————————————
 *修改记录
 *    修改者：
 *    修改时间：
 *    修改原因：
 *——————————————————————————————————————
 */
package com.pearlsoft.webapp.rms.myres.service;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.Date;

import com.pearlsoft.util.DateUtils;
import com.pearlsoft.webapp.core.dao.RecrodRowMapper;
import com.pearlsoft.webapp.core.dataset.Record;
import com.pearlsoft.webapp.core.dataset.SimpleRecord;

/**
 *描述： 
 *
 * 
 */
public class MyResRowMapperHelper {
	/**
	 * 我的资源
	 * @return
	 */
	public static RecrodRowMapper<Record> myResRowMapper(){
		return new  RecrodRowMapper<Record>(){
			@Override
			public Record mapRow(ResultSet rs, int rowNum)
					throws SQLException {
				SimpleRecord recrod = new SimpleRecord();
				recrod.setValue("resId", rs.getString(1));
				recrod.setValue("applyId", rs.getString(2));
				recrod.setValue("ownerId", rs.getString(3));
				recrod.setValue("resName", rs.getString(4));
				recrod.setValue("resDesc", rs.getString(5));
				recrod.setValue("startDate", rs.getDate(6)==null ?"":DateUtils.getDateFormat(new Date(rs.getDate(6).getTime()),"yyyy-MM-dd"));
				recrod.setValue("endDate", rs.getDate(7)==null ?"":DateUtils.getDateFormat(new Date(rs.getDate(7).getTime()),"yyyy-MM-dd"));
				recrod.setValue("status",rs.getString(8));
				recrod.setValue("eName",rs.getString(9));
				
				return recrod;
			}
		};
	}
	/***
	 * 我的资源主机
	 * @return
	 */
	public static RecrodRowMapper<Record> myResHostRowMapper(){
		return new  RecrodRowMapper<Record>(){
			@Override
			public Record mapRow(ResultSet rs, int rowNum)
					throws SQLException {
				SimpleRecord recrod = new SimpleRecord();
				//hostId,resId,hostName,hostDesc,hostIp,account,pwd,
				//opsSeries,opsName,cups,memory,memoryunit,
				//storage,storageunit,netcards 
				recrod.setValue("hostId", rs.getString(1));
				recrod.setValue("resId", rs.getString(2));
				recrod.setValue("hostName", rs.getString(3));
				recrod.setValue("hostDesc", rs.getString(4));
				recrod.setValue("hostIp", rs.getString(5));
				recrod.setValue("account", rs.getString(6));
				recrod.setValue("pwd", rs.getString(7));
				recrod.setValue("opsSeries", rs.getString(8));
				recrod.setValue("opsName", rs.getString(9));
				recrod.setValue("cups", rs.getString(10));
				recrod.setValue("memory", rs.getString(11));
				recrod.setValue("memoryunit", rs.getString(12));
				recrod.setValue("storage", rs.getString(13));
				recrod.setValue("storageunit", rs.getString(14));
				recrod.setValue("netcards",rs.getString(15));
				return recrod;
			}
		};
	}	
	
}
